package com.uzipi.springboot.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.uzipi.springboot.service.DemoService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * DemoController:
 *
 * @author cmwang5
 * @since 2018/6/26 15:18
 */
@RestController
@RequestMapping("/test")
public class DemoController {

    // 使用 @Reference 注解，引入服务提供者提供的服务。相当于 xml 中配置reference
    @Reference(
            version = "1.0.0",  // version取决于Provider @Service 所指定的版本
            application = "${dubbo.application.id}"
    )
    private DemoService demoService;


    @RequestMapping("/getdata/{name}")
    public String getData(@PathVariable("name") String name){
        System.out.println("输入了name：" + name);
        return demoService.getData(name);
    }
}
